import instance from "@/utils/request";
/**
 * 项目表
 *
 * Projects
 */
export interface Project {
    pjtNo?: string;
    cltNo?: string;
    pjtName?: string;
    pjtMoney?: string;
    pjtBuildtime?: string;
    pjtStatus?: string;
    pjtFinishtime?: string;
    pjtStop?: string;
    cltName?: string;
    pjtStatusName?: string;
    stfStatus?: string;
}

/**
 * 项目记录表
 *
 * ProjectRecords
 */
export interface ProjectRecord {
    adminName?: string;
    adminTel?: string;
    staffName?: string;
    staffTel?: string;
    isFinished?: string;
    isChecked?: string;
    clientCheckStatus?: string;
    manageCheckStatus?: string;
    fileStatus?: string;
    finishStatus?: string;
    fileStatusName?: string;
}
// 根据userId查询所有Projects
export function getAllProjects(uid: string) {
    return instance.get('/project/queryByClientId', {
      params: {
        userId: uid,
      }
    });
}
// 根据userId查询所有Projects
export function getAllProjectsByUserId(uid: string) {
    return instance.get('/project/queryByUserId', {
      params: {
        userId: uid,
      }
    });
}
// 根据PjtNo查询项目信息
export function getProjectInfoByPjtNo(pjtNo: string) {
  return instance.get('/project/' + pjtNo);
}
// 根据PjtNo和PcsNo查询流程信息
export function getProcessInfoByPjtNoAndPcsNo(pjtNo: string, pcsNo: string) {
  return instance.get('/projectRecord/queryObject',{
      params: {
        pjtNo: pjtNo,
        pcsNo: pcsNo,
      }
  });
}
// 添加客户
export function createProjectByInfo(info: Project) {
    return instance.post('/project/addProject', info);
}

// 根据PjtNo查询项目信息
export function getAllStaffById(uid: string) {
  return instance.get('/staff/queryStaffByUserIdStatus?userId='+ uid );
}
export function editFileStatus(pjtNo:string, pcsNo:string) {
    return instance.put('/projectRecord/editFileStatus', null, {
        params: {
            pjtNo,
            pcsNo
        }
    })
}
export function queryByUserIdCompleted(userId:string) {
    return instance.get('/project/queryByUserIdcompleted', {
        params: {
          userId
        }
    })

}
export function queryByUserIdUncompleted(userId:string) {
    return instance.get('/project/queryByUserIdUncompleted', {
        params: {
          userId
        }
    })

}
export function acceptCheckManage(pcsNo, pjtNo) {
    return instance.put('/projectRecord/acceptCheck', null, {
        params: {
            pcsNo,
            pjtNo
        }
    })
}

export function acceptCheckClient(pcsNo, pjtNo) {
    return instance.put('/projectRecord/acceptCheckClient', null, {
        params: {
            pcsNo,
            pjtNo
        }
    })
}

export function refuseCheckManage(userId, pcsNo, pjtNo, reason) {
    return instance.put('/projectRecord/refuseCheck', null, {
        params: {
            userId,
            pcsNo,
            pjtNo,
            reason
        }
    })
}

export function refuseCheckClient(userId, pcsNo, pjtNo, reason) {
    return instance.put('/projectRecord/refuseCheckClient', null, {
        params: {
            userId,
            pcsNo,
            pjtNo,
            reason
        }
    })
}

export function checkFirst(userId, pjtNo, isAccepted, reason) {
    return instance.put('/project/checkDocument', null, {
        params: {
            userId,
            pjtNo,
            isAccepted,
            reason
        }
    })
}


export function refuseTheTask(pjtNo, pcsNo, reason, userId) {
    return instance.delete('/projectRecord/refuseTask', {
        params: {
            pjtNo,
            pcsNo,
            reason,
            userId
        }
    })
}
